stateFormtter = function (value, row, index) {
    if (value == 1) {
        return '<span style="color:#FAB61F">待审核</span>';
    } else if (value == 2) {
        return '<span style="color:#00e765">审核通过</span>';
    } else if (value == 3) {
        return '<span style="color:red">审核拒绝</span>';
    }
};


dealTimeFormatter = function (value, row, index) {
    if (row.dealTime == null || row.dealTime == "") {
        return '暂无';
    } else {
        return row.dealTime;
    }
};

dealNameFormatter = function (value, row, index) {
    if (row.dealName == null || row.dealName == "") {
        return '暂无';
    } else {
        return row.dealName;
    }
};


bindClick("#btnSearch", function () {
    var bussNameS = $("input[name=bussNameS]").val();
    var checkBusinessName = $("input[name=checkBusinessName]").val();
    var checkDeliveryName = $("input[name=checkDeliveryName]").val();
    var cashstatus = $("select[name=stateS]").val();

    var timeS = $("input[name=timeS]").val();

    var start = "";
    var end = "";
    if (timeS != null) {
        start = timeS.split(" - ")[0];
        end = timeS.split(" - ")[1];
    }


    var url = $().AbsUrlParse("/web/cash/indexQuery?bussName=" + bussNameS + "&checkBusinessName=" + checkBusinessName + "&checkDeliveryName=" + checkDeliveryName + "&cashstatus=" + cashstatus + "&start=" + start + "&end=" + end);
    $("#table").bootstrapTable("refresh", {"url": url});
})


function initDateRange() {
    $(".rangedate").daterangepicker({
        "autoApply": true,
        "locale": {
            "applyLabel": "确定",
            "cancelLabel": "取消",
            "fromLabel": "开始",
            "toLabel": "结束",
            "customRangeLabel": "Custom",
            "weekLabel": "周",
            "daysOfWeek": [
                "日",
                "一",
                "二",
                "三",
                "四",
                "五",
                "六"
            ],
            "monthNames": [
                "1月",
                "2月",
                "3月",
                "4月",
                "5月",
                "6月",
                "7月",
                "8月",
                "9月",
                "10月",
                "11月",
                "12月"
            ],
            "cancelLabel": '清空',
            "opens": "right"
        },
        "format": "YYYY-MM-DD"
    }).on('cancel.daterangepicker', function (ev, picker) {
        $(this).val('');
    });
}

//初始化页面的时候运行该函数
$(function () {
    initDateRange();
});
